package com.cvs.service.impl;

import com.cvs.bean.JifenGood;
import com.cvs.dao.JifenGoodMapper;
import com.cvs.dao.JifenMapper;
import com.cvs.service.JifenGoodService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service("jifenGoodService")
public class JifenGoodServiceimpl implements JifenGoodService {
    @Autowired
   private JifenGoodMapper jifenGoodMapper;
    @Override
    public List<JifenGood> findAll() {
        return jifenGoodMapper.findAll();
    }

    @Override
    public PageInfo<JifenGood> findAllBypage(int pageNum,int pageSize) {
        PageHelper.startPage(pageNum,pageSize);
       List<JifenGood> jifenGoods= jifenGoodMapper.findAllBypage();
        PageInfo pageInfo=new PageInfo(jifenGoods);
        return pageInfo;
    }

    @Override
    public JifenGood findOne(int id) {
        return jifenGoodMapper.findOne(id);
    }

    @Override
    public JifenGood findGoodInfo(int id) {
        return jifenGoodMapper.findGoodInfo(id);
    }

    @Override
    public int updateJifenGood(JifenGood jifenGood) {
        return jifenGoodMapper.updateJifenGood(jifenGood);
    }
}
